Skip to content

Relational-Database-Design-Functional-Dependency

Functional dependencies are some constraints on the set of legal relations. The constraint is that the value for a certain set of attributes uniquely determines the value for another set of attributes. 约束条件是一组属性的值唯一确定另一组属性的值 A functional dependency is a generalization of the notion of a key. 功能依赖关系是键概念的泛化

Functional Dependency Property 功能依赖

  • K is a super key for relation schema iff KR

  • K is a condidate key for R iff KR and for no αK,αR

  • Functional dependencies can express constraints that cannot be expressed using superkeys. For example:

courseinfo=(c_name,p_code,credits,domain,c_number)

We can use functional dependency to hold

c_namecredits

But would not expect the following to hold:

creditsc_name

  • we can use functional dependency to specify constraints on the set of legal relations

  • Trivial A functional dependency is trivial if it is satisfied by all instances of a relation. Equivalently, If $\beta \subseteq \alpha $, then αβ is trivial. Example: (credits,domain,c_numberc_number)(c_namec_name)

Closure of a Set of Functional Dependencies 功能依赖的闭包

The set of all functional dependencies logically implied by F is the closure of F, denoted by F+.

F+ is a superset of F.

How to find F+

  • Applying Armstrong's Axioms
    1. reflexivity
      • if βα, then αβ
    2. augumentation
      • if αβ, then γαγβ for any γ.
    3. transitivity
      • if αβ and βγ, then αγ.
  • These rules are sound and complete.

This method is also apply in Attribute Closure.

Prove Armstrong's Axioms

For Union: If $\alpha \rightarrow \beta $ and αγ, then αγβ

  1. αβ
  2. αααβ According to augmentation
  3. ααβ
  4. αγ
  5. αβγβ
  6. ααββγ According to transitivity
  7. αβγ

For Decomposition: if αβγ, then αβ and αγ

  1. αβγ
  2. βγβ according to reflexivity
  3. βγγ according to reflexivity
  4. αβ,αγ according to transitivity

For pseudotransitivity if αβ and γβϵ then αγϵ

  1. αβ
  2. αγβγ according to augmentation
  3. αγβγϵ according to transitivity
  4. αγϵ